// 搜索列表处理
const cheerio = require('cheerio');
const abc_search = (html, source, baseUrl) => {
	let searchList = [];
	let $ = $1(html);
	$('.type_show .bookbox').each((i, item) => {
		let info = {
			avatar: baseUrl + $(item).find('.bookimg a img').attr('src'),
			bookId: $(item).find('.bookimg a').attr('href').split('/')[1],
			bookName: $(item).find('.bookname a').text(),
			classify: $(item).find('.cat').text().split('：')[1],
			author: $(item).find('.author').text().split('：')[1],
			newChapter: $(item).find('.update a').text(),
			// intro: $(item).find('.bookinfo p').text(),
			source,
		};
		searchList.push(info);
	});
	return searchList;
};

// const yetian_search = (html, source) => {
// 	return abc_search(html, source);
// };

function $1(html) {
	return cheerio.load(html);
}
module.exports = {
	abc_search,
	// yetian_search,
};
